using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Marketplace.Engine.Repository.Generic
{
    public class GenericValidator<T>
    {
        public IList<ValidationResult> Validate(T entity)
        {
            var results = new List<ValidationResult>();
            var context = new ValidationContext(entity, null, null);
            
            Validator.TryValidateObject(entity, context, results);
            return results;            
        }
    }
}